package com.google.gson.internal.bind;

import com.google.gson.a.a;
import com.google.gson.internal.ObjectConstructor;
import com.google.gson.internal.b;
import com.google.gson.internal.bind.TypeAdapter.Factory;
import com.google.gson.internal.f;
import java.lang.reflect.Type;
import java.util.Map;

public final class j implements Factory {
    private final f a;
    private final boolean b;

    public j(f fVar, boolean z) {
        this.a = fVar;
        this.b = z;
    }

    private TypeAdapter a(l lVar, Type type) {
        return (type == Boolean.TYPE || type == Boolean.class) ? y.d : lVar.a(a.a(type));
    }

    public TypeAdapter create(l lVar, a aVar) {
        Type b = aVar.b();
        if (!Map.class.isAssignableFrom(aVar.a())) {
            return null;
        }
        Type[] b2 = b.b(b, b.e(b));
        TypeAdapter a = a(lVar, b2[0]);
        TypeAdapter a2 = lVar.a(a.a(b2[1]));
        ObjectConstructor a3 = this.a.a(aVar);
        return new k(this, lVar, b2[0], a, b2[1], a2, a3);
    }
}
